package org.foj.builder;

import org.foj.model.Comment;
import org.foj.model.Issue;

import java.util.Date;

/**
 * @author jeremy anderson
 */
public class CommentBuilder {

    private Long id = 1L;
    private Issue issue = new IssueBuilder().build();
    private String author = "author";
    private Date createdDate = new Date();
    private String commentText = "comment text";

    public CommentBuilder withId(Long id) {
        this.id = id;
        return this;
    }

    public CommentBuilder withIssue(Issue issue) {
        this.issue = issue;
        return this;
    }

    public CommentBuilder withAuthor(String author) {
        this.author = author;
        return this;
    }

    public CommentBuilder withCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
        return this;
    }

    public CommentBuilder withCommentText(String commentText) {
        this.commentText = commentText;
        return this;
    }

    public Comment build() {
        Comment comment = new Comment();
        comment.setId(id);
        comment.setIssue(issue);
        comment.setAuthor(author);
        comment.setCreatedDate(createdDate);
        comment.setCommentText(commentText);

        return comment;
    }

}
